package com.haoshuang.zhouzhoubang.ui.page.order.time

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.ServiceTimeBean
import com.haoshuang.zhouzhoubang.model.bean.TimeBean2
import com.haoshuang.zhouzhoubang.model.bean.TimeBean99
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.ResponseBean
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class UpdateServiceTimeViewModel : BaseViewModel() {

    /**
     * 获取服务时间
     */
    val getMasterServiceTimeData =
        StatefulMutableLiveData<ResponseBean<MutableList<TimeBean2>>>()

    fun getMasterServiceTime(time: String, cate_id: String) = netRequest {
        start { getMasterServiceTimeData.value = StateData.Loading }
        request { ApiRepo.getMasterServiceTime(time, cate_id) }
        success { getMasterServiceTimeData.value = StateData.Success(it) }
        error { code, msg ->
            getMasterServiceTimeData.value = StateData.Error(code, msg)
        }
    }



}